MIO/EMIO(Key/LED/Buzzer)Test

Create Vivado Project

Modify the project based on the previous Hello World or E2PROM Vivado project:

The schematic is as follows: It involves two keys and two LEDs connected to the PS MIO, two keys and two LEDs connected to the PS EMIO, and one EMIO IO used to control the buzzer.

image-20250623120853595

image-20250722114056058

 

image-20250722114033885

 

image-20250623120957863

To configure the PS side, directly click on GPIO MIO. By default, all pins are selected. We need to use PS_KEY0 corresponding to MIO0, PS_KEY1 corresponding to MIO11, PS_LED0 corresponding to MIO7, and PS_LED1 corresponding to MIO8.

VeryCapture_20250618160905

There are five IOs that need to be set as EMIO, corresponding to two keys, two LEDs, and one buzzer. Therefore, just select 5 during configuration. If you select more, you must also configure constraints for the extra pins in the subsequent pin constraints:

image-20250722114213223

 

Click OK. Similarly, right-click on GPIO_0 and click Make External. The software will automatically generate external pins corresponding to the EMIO interface in the top-level module:

 

VeryCapture_20250618160943

The next steps are the same as for IIC, with the only difference being the pin constraints. Here, I will use the checkbox method to configure the pin constraints, as derived from the schematic:

image-20250811141202632

In the interface, [0], [1], [2], [3], and [4] correspond to PL_KEY0, PL_KEY1, PL_LED0, PL_LED1, and BEEP, respectively.

After that, sequentially run synthesis, implementation, and generate bitstream, and finally generate a new .xsa file:

VeryCapture_20250618121240

Create Vitis Application Project

In Vitis, update the platform project: Right-click the created platform project, click Update Hardware Specification, select the .xsa file path. The following pop-up box will appear; click OK, which indicates a successful update. The platform project will show as "out of date," at which point you need to rebuild the platform project.

VeryCapture_20250618121412

VeryCapture_20250618121446

VeryCapture_20250618121501

Similarly, click File-->new-->Application Project;

Select an empty .c project;

Then, add the .c file.

The program implements four keys to control four LEDs respectively. When a key is pressed, the corresponding LED lights up; when the key is released, the LED turns off.

It should be noted that the pin numbers for MIO are 0-53, and the pin numbers for EMIO start from 54. Since 5 pins were extended for EMIO this time, the corresponding numbers are 54-58

 

Compile and Debug

After the project is successfully compiled, connect the development board's JTAG to the computer using a Type-C USB cable. Use another Type-C USB cable to connect the development board's PS UART to the computer.

image-20250623121604830

On the computer, open the serial debugging tool MobaXterm and establish a connection with the development board's PS UART.

image-20250623121329304

In Vitis, enter debug mode: Under Debug As, select the first option. Running at full speed will allow you to see debug information through the serial port, and you will observe the corresponding phenomena on the development board.

image-20250813190008282

After running, pressing or releasing the corresponding keys will print information about the key press or release in the serial port, and the corresponding LEDs will light up or turn off.

image-20250813185854233